package com.github.bitsapling.sapling.service;

import com.github.bitsapling.sapling.entity.User;
import com.github.bitsapling.sapling.controller.bo.UserBO;
import com.github.bitsapling.sapling.controller.dto.UserSessionResponseDTO;

import java.util.List;

public interface UserService {
    /**
     * @Description 创建跟新用户基本信息
     * @Author cx
     * @param user
     */
    public User createOrUpdate(User user);

    public User getUserById(long id);

    public User getUserByUsername(String username);

    public User getUserByEmail(String email);

    public User getUserByPasskey(String passkey);

    public UserSessionResponseDTO getUserSessionResponseDTO(User user);

    public String getPasskeyById(long id);

    public List<User> getAllUsers();

    public boolean deleteUser(User user);
    /**
     * 计算用户的上传促销偏移量
     * @param userId 用户 ID
     * @param lastDownload 上次下载量
     * @return 上传促销偏移量
     */
    long calculatePromotionUploadOffset(long userId, long lastDownload);

    /**
     * 计算用户的下载促销偏移量
     * @param userId 用户 ID
     * @param lastUploaded 上次上传量
     * @return 下载促销偏移量
     */
    long calculatePromotionDownloadOffset(long userId, long lastUploaded);

    public long getPromotionUploadOffset(long userId);
    public long getPromotionDownloadOffset(long userId);
    public float calculateShaereIndex(long userId);
    public float calculateMagicIndex(long userId);
}
